<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 */

$this->headTitle($this->category['name'] . ' - ' . Gio_Core_String::removeSign($this->category['name'], ' ') . ' - ' . $this->TRANSLATOR->translator('common_default_title', 'core'));
?>
<?php if ($categoryArticles = $this->articles) : ?>
<div class="ninhgio">
	<div class="news-article-category">
		<?php if ($this->topArticle) : ?>
		<div class="newsItems newsOne">
			<?php if (isset($this->topArticle['image_medium']) && $this->topArticle['image_medium']) : ?>
			<div class="article-top-image">
				<a href="<?php echo $this->url('news_article_details', $this->topArticle); ?>" title="<?php echo $this->STRING->escape($this->topArticle['title']); ?>">
					<img src="<?php echo $this->APP_RESOURCE_SERVER; ?>/<?php echo $this->topArticle['image_medium']; ?>" alt="<?php echo $this->STRING->escape($this->topArticle['title']); ?>" />
				</a>
			</div>
			<?php else : ?>
				<?php if (isset($this->topArticle['image_url']) && $this->topArticle['image_url']) : ?>
				<div class="article-top-image">
					<a href="<?php echo $this->url('news_article_details', $this->topArticle); ?>" title="<?php echo $this->STRING->escape($this->topArticle['title']); ?>">
						<img src="<?php echo $this->topArticle['image_url']; ?>" alt="<?php echo $this->STRING->escape($this->topArticle['title']); ?>" />
					</a>
				</div>
				<?php endif; ?>
			<?php endif; ?>
			<a class="red title" href="<?php echo $this->url('news_article_details', $this->topArticle); ?>" title="<?php echo $this->STRING->escape($this->topArticle['title']); ?>">
				<?php echo $this->topArticle['title']; ?>
				<?php if ($this->topArticle['article_photo'] == 1) : ?>
				<img border="0" alt="" src="/skins/{!!Gio{$SKIN}Smarty!!}/images/photo.gif" />
				<?php endif; ?>
			</a>
			<div class="time">
				<cite><?php echo date($this->CONFIG->timezone->datetime, strtotime($this->topArticle['created_date'])); ?></cite>
			</div>
			<div class="desc">
				<?php echo strip_tags($this->topArticle['description']); ?>
			</div>
			<div style="clear: both;"></div>
		</div>
		<?php endif; ?>
		<!-- Danh sach cac tin bai trong Cate -->
		<div class="articleListWraper">
			<?php foreach ($categoryArticles as $index => $article) : ?>
     		<?php if ($index > 0 && $index < 15) : ?>
     		<div class="newsItems">
     			<?php if (isset($article['image_general']) && $article['image_general']) : ?>
     			<div class="article-image">
					<a href="<?php echo $this->url('news_article_details', $article); ?>" title="<?php echo $this->STRING->escape($article['title']); ?>">
						<img src="<?php echo $this->APP_RESOURCE_SERVER; ?>/<?php echo $article['image_general']; ?>" alt="<?php echo $this->STRING->escape($article['title']); ?>" />
					</a> 
				</div>
				<?php else : ?>
					<?php if (isset($article['image_url']) && $article['image_url']) : ?>
					<div class="article-image">
						<a href="<?php echo $this->url('news_article_details', $article); ?>" title="<?php echo $this->STRING->escape($article['title']); ?>">
							<img src="<?php echo $article['image_url']; ?>" alt="<?php echo $this->STRING->escape($article['title']); ?>" />
						</a>
					</div>
					<?php endif; ?>
				<?php endif; ?>
				<a class="title" href="<?php echo $this->url('news_article_details', $article); ?>" title="<?php echo $this->STRING->escape($article['title']); ?>">
					<?php echo $article['title']; ?>
				</a>
				<div class="time">
					<cite><?php echo date($this->CONFIG->timezone->datetime, strtotime($article['created_date'])); ?></cite>
				</div>
				<div class="desc">
					<?php echo strip_tags($article['description']); ?>
				</div>
				<div style="clear: both;"></div>
			</div>
			<?php endif; ?>
			<?php endforeach; ?>                        
		</div>
	</div>
</div>
	<?php if (count($categoryArticles) > 15) : ?>
	<div class="ninhgio mb5">
		<div class="news-article-related">
			<h2><?php echo $this->TRANSLATOR->translator('article_other_articles'); ?></h2>
		    <ul>
		    	<?php foreach ($categoryArticles as $index => $article) : ?>
			    <?php if ($index >= 15) : ?>
				<li>                
					<a target="_self" href="<?php echo $this->url('news_article_details', $article); ?>" class=""><?php echo $article['title']; ?></a>
					<span class="gray"> - <?php echo date($this->CONFIG->timezone->date, strtotime($article['created_date'])); ?></span>
				</li>
				<?php endif; ?>
				<?php endforeach; ?>
		    </ul>
		</div>
		<div class="optionView">
			<div style="float: right; padding-right: 50px; color: #0261A1;">
				<?php if (!$this->pager->isFirstPage()) : ?>
				<a href="<?php echo $this->linkTagsRaw['prev']['url']; ?>"><strong><?php echo $this->TRANSLATOR->translator('common_pager_prev', 'core'); ?></strong></a>
				<?php if (!$this->pager->isLastPage()) : ?> | <?php endif; ?>
				<?php endif; ?>
				<?php if (!$this->pager->isLastPage()) : ?>
				<a href="<?php echo $this->linkTagsRaw['next']['url']; ?>"><strong><?php echo $this->TRANSLATOR->translator('common_pager_next', 'core'); ?></strong></a>
				<?php endif; ?>
			</div>
		</div>                  
		<div class="clear"></div>
	</div>
	<?php endif; ?>
<?php endif; ?>